import java.util.Arrays;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 86184
 * Date: 2023-01-30
 * Time: 13:18
 */
public class Two_dimensional_array {
    public static void main(String[] args) {
        //二维数组的定义
        int[][] array1 = new int[3][4];
        int[][] array2 = new int[][]{{1, 2, 3}, {4, 5, 6}};   //一定要对每行的数组进行大括号区分
        int[][] array3 = {{1, 2, 3}, {4, 5, 6}};
        //不规则二维数组的定义
        int[][] array4=new int[3][];   //列可以省略，但是数组就为null
        array4[0]=new int[3];   //3列
        array4[1]=new int[4];   //4列
        array4[2]=new int[5];   //5列
        //遍历
        for (int i = 0; i <array4.length ; i++) {  //行
            for (int j = 0; j <array4[i].length ; j++) {  //列
                System.out.print(array4[i][j]+" ");
            }
            System.out.println();
        }
        //打印
        System.out.println(array4);
        System.out.println(array4[0]);

        System.out.println(Arrays.deepToString(array4));
        System.out.println(Arrays.toString(array4[0]));
    }
}
